﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using CostTrade.Core.Data;
using Natrue.Data.FastMapping;

namespace CostTrade.BusinessLayer
{
    /// <summary>
    /// 订单内容
    /// </summary>
    [ActiveRecord("tbOrderFormWares"), Serializable]
    public class OrderFormWares : CBBase
    {
        private readonly Guid primaryKey = Guid.NewGuid();
        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access = PropertyAccess.NosetterCamelcase),Mark("")]
        public override Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        /// <summary>
        /// 商品
        /// </summary>
        private Wares mapWare;
        /// <summary>
        /// 每箱数量
        /// </summary>
        private double everyBoxCount;
        /// <summary>
        /// 装箱数
        /// </summary>
        private double boxCount;
        /// <summary>
        /// 数量
        /// </summary>
        private double totalCount;
        /// <summary>
        /// 商品单价
        /// </summary>
        private double orderPrice;
        /// <summary>
        /// 商品总值
        /// </summary>
        private double totalPrice;

        private bool hasFavorable;
        private double favorable;
        private double favorableValue;

        /// <summary>
        /// 商品
        /// </summary>
        [BelongsTo,Mark("商品",IsNotNull = true)]
        public Wares MapWare
        {
            get { return mapWare; }
            set { mapWare = value; }
        }

        /// <summary>
        /// 每箱数量
        /// </summary>
        [Property, Mark("每箱数量")]
        public double EveryBoxCount
        {
            get { return everyBoxCount; }
            set { everyBoxCount = value; }
        }

        /// <summary>
        /// 装箱数
        /// </summary>
        [Property, Mark("装箱数")]
        public double BoxCount
        {
            get { return boxCount; }
            set { boxCount = value; }
        }

        /// <summary>
        /// 数量
        /// </summary>
        [Property, Mark("数量")]
        public double TotalCount
        {
            get { return totalCount; }
            set { totalCount = value; }
        }

        /// <summary>
        /// 商品单价
        /// </summary>
        [Property, Mark("商品单价")]
        public double OrderPrice
        {
            get { return orderPrice; }
            set { orderPrice = value; }
        }

        /// <summary>
        /// 商品总值
        /// </summary>
        [Property, Mark("商品总值")]
        public double TotalPrice
        {
            get { return totalPrice; }
            set { totalPrice = value; }
        }

        /// <summary>
        /// 是否有优惠
        /// </summary>
        [Property, Mark("是否有优惠")]
        public bool HasFavorable
        {
            get { return hasFavorable; }
            set { hasFavorable = value; }
        }

        /// <summary>
        /// 优惠百分比 
        /// </summary>
        [Property, Mark("优惠百分比")]
        public double Favorable
        {
            get { return favorable; }
            set { favorable = value; }
        }

        /// <summary>
        /// 优惠价
        /// </summary>
        [Property, Mark("优惠价")]
        public double FavorableValue
        {
            get { return favorableValue; }
            set { favorableValue = value; }
        }
    }
}